package org.qqcui.designpattern.patterns.builder.builder;

import org.qqcui.designpattern.patterns.builder.builder.concrete.CommonHouseBuilder;
import org.qqcui.designpattern.patterns.builder.builder.concrete.HighBuildingBuilder;
import org.qqcui.designpattern.patterns.builder.builder.director.HouseDirector;
import org.qqcui.designpattern.patterns.builder.builder.product.House;

/**
 * 客户端
 *
 * @author cuiqingqiang
 * @version 1.0
 * @date 2022/4/28 16:10
 **/
public class Client {

    public static void main(String[] args) {
        // 盖普通房屋
        CommonHouseBuilder commonHouseBuilder = new CommonHouseBuilder();
        HouseDirector houseDirector = new HouseDirector(commonHouseBuilder);
        House house = houseDirector.constructHouse();
        System.out.println(house);

        // 盖高层建筑
        HighBuildingBuilder highBuildingBuilder = new HighBuildingBuilder();
        houseDirector.setHouseBuilder(highBuildingBuilder);
        House highBuilding = houseDirector.constructHouse();
        System.out.println(highBuilding);
    }
}
